#!/usr/bin/env python
# coding=utf-8


from config import *


def Post_UpdateDomainRecord(accessKeyId, accessSecret, city, write_TTL, write_Type, write_Value, RecordId, RR):
    from aliyunsdkcore.client import AcsClient
    from aliyunsdkcore.acs_exception.exceptions import ClientException
    from aliyunsdkcore.acs_exception.exceptions import ServerException
    from aliyunsdkalidns.request.v20150109.UpdateDomainRecordRequest import UpdateDomainRecordRequest

    client = AcsClient(accessKeyId, accessSecret, city)

    request = UpdateDomainRecordRequest()
    request.set_accept_format('json')

    request.set_RecordId(RecordId)
    request.set_RR(RR)
    request.set_Type(write_Type)
    request.set_Value(write_Value)
    request.set_TTL(write_TTL)

    response = client.do_action_with_exception(request)

    # print(str(response, encoding='utf-8'))


if __name__ == '__main__':
    Post_UpdateDomainRecord(accessKeyId,
                            accessSecret,
                            city,
                            write_TTL,
                            write_Type,
                            write_Value="",
                            RecordId=None,
                            RR=None)
